/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Outdoor.java
 *
 * Created on 1/Abr/2009, 16:58:08
 */

package Viewer;

/**
 *
 * @author Rui Deyllot
 */

import javax.swing.*;
import Socket.Cenoura.*;
import Socket.Coelho.*;
import Concurrent.Cenoura.*;
import Concurrent.Coelho.*;
import RMI.Cenoura.*;
import RMI.Coelho.*;
import RMI.Server.RemotePrado;
import java.util.Random;
import java.rmi.RMISecurityManager;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;

public class Outdoor extends javax.swing.JFrame {

    //User Created Variables
    private int input[];
    private Thread prado;
    private boolean stopFlag = false;

    /** Creates new form Outdoor */
    public Outdoor() {
        initComponents();
        TaskLabel.setVisible(false);
        ProgressBar.setVisible(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        StatusPanel = new javax.swing.JPanel();
        ProgressBar = new javax.swing.JProgressBar();
        TaskLabel = new javax.swing.JLabel();
        addressfield = new javax.swing.JTextField();
        lblend = new javax.swing.JLabel();
        portfield = new javax.swing.JTextField();
        lbldoor = new javax.swing.JLabel();
        applyaddress = new javax.swing.JButton();
        FieldPanel = new javax.swing.JPanel();
        square00 = new javax.swing.JLabel();
        square01 = new javax.swing.JLabel();
        square02 = new javax.swing.JLabel();
        square03 = new javax.swing.JLabel();
        square04 = new javax.swing.JLabel();
        square05 = new javax.swing.JLabel();
        square15 = new javax.swing.JLabel();
        square14 = new javax.swing.JLabel();
        square13 = new javax.swing.JLabel();
        square12 = new javax.swing.JLabel();
        square11 = new javax.swing.JLabel();
        square10 = new javax.swing.JLabel();
        square25 = new javax.swing.JLabel();
        square24 = new javax.swing.JLabel();
        square23 = new javax.swing.JLabel();
        square22 = new javax.swing.JLabel();
        square21 = new javax.swing.JLabel();
        square20 = new javax.swing.JLabel();
        square35 = new javax.swing.JLabel();
        square34 = new javax.swing.JLabel();
        square33 = new javax.swing.JLabel();
        square32 = new javax.swing.JLabel();
        square31 = new javax.swing.JLabel();
        square30 = new javax.swing.JLabel();
        square45 = new javax.swing.JLabel();
        square44 = new javax.swing.JLabel();
        square43 = new javax.swing.JLabel();
        square42 = new javax.swing.JLabel();
        square41 = new javax.swing.JLabel();
        square40 = new javax.swing.JLabel();
        square55 = new javax.swing.JLabel();
        square54 = new javax.swing.JLabel();
        square53 = new javax.swing.JLabel();
        square52 = new javax.swing.JLabel();
        square51 = new javax.swing.JLabel();
        square50 = new javax.swing.JLabel();
        ConfigLabel = new javax.swing.JLabel();
        LinesLabel = new javax.swing.JLabel();
        ColumnsLabel = new javax.swing.JLabel();
        RabbitsLabel = new javax.swing.JLabel();
        RabbitsField = new javax.swing.JFormattedTextField();
        EnergiesLabel = new javax.swing.JLabel();
        EgField = new javax.swing.JFormattedTextField();
        EgLabel = new javax.swing.JLabel();
        EsLabel = new javax.swing.JLabel();
        EsField = new javax.swing.JFormattedTextField();
        EfLabel = new javax.swing.JLabel();
        EfField = new javax.swing.JFormattedTextField();
        EtField = new javax.swing.JFormattedTextField();
        EtLabel = new javax.swing.JLabel();
        EjLabel = new javax.swing.JLabel();
        EjField = new javax.swing.JFormattedTextField();
        OthersLabel = new javax.swing.JLabel();
        TfLabel = new javax.swing.JLabel();
        TfField = new javax.swing.JFormattedTextField();
        SminLabel = new javax.swing.JLabel();
        SminField = new javax.swing.JFormattedTextField();
        LinesSpinner = new javax.swing.JSpinner();
        ColumnsSpinner = new javax.swing.JSpinner();
        SmaxLabel = new javax.swing.JLabel();
        SmaxField = new javax.swing.JFormattedTextField();
        TopMenu = new javax.swing.JMenuBar();
        FileMenu = new javax.swing.JMenu();
        QuitItem = new javax.swing.JMenuItem();
        ActionMenu = new javax.swing.JMenu();
        StartItem = new javax.swing.JMenuItem();
        StopItem = new javax.swing.JMenuItem();
        MethodMenu = new javax.swing.JMenu();
        ConcurItem = new javax.swing.JRadioButtonMenuItem();
        SocketItem = new javax.swing.JRadioButtonMenuItem();
        rmiItem = new javax.swing.JRadioButtonMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        ProgressBar.setEnabled(false);

        TaskLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
        TaskLabel.setText("Current Task:");
        TaskLabel.setEnabled(false);

        addressfield.setText("localhost");
        addressfield.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addressfieldActionPerformed(evt);
            }
        });

        lblend.setText("Endereço");

        portfield.setText("5000");

        lbldoor.setText("Porta");

        applyaddress.setText("Accept");
        applyaddress.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applyaddressActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout StatusPanelLayout = new javax.swing.GroupLayout(StatusPanel);
        StatusPanel.setLayout(StatusPanelLayout);
        StatusPanelLayout.setHorizontalGroup(
            StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(StatusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(TaskLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(42, 42, 42)
                .addComponent(lblend)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addressfield, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(14, 14, 14)
                .addComponent(lbldoor)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(portfield, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(applyaddress)
                .addContainerGap(142, Short.MAX_VALUE))
        );
        StatusPanelLayout.setVerticalGroup(
            StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, StatusPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(TaskLabel)
                    .addGroup(StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblend)
                            .addComponent(addressfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(portfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbldoor)
                            .addComponent(applyaddress))
                        .addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        FieldPanel.setBackground(new java.awt.Color(0, 102, 0));

        square00.setForeground(new java.awt.Color(255, 255, 255));
        square00.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square00.setText("RCS");
        square00.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square00.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square00.setMaximumSize(new java.awt.Dimension(30, 20));
        square00.setMinimumSize(new java.awt.Dimension(30, 20));
        square00.setPreferredSize(new java.awt.Dimension(30, 20));

        square01.setForeground(new java.awt.Color(255, 255, 255));
        square01.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square01.setText("RCS");
        square01.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square01.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square01.setMaximumSize(new java.awt.Dimension(30, 20));
        square01.setMinimumSize(new java.awt.Dimension(30, 20));
        square01.setPreferredSize(new java.awt.Dimension(30, 20));

        square02.setForeground(new java.awt.Color(255, 255, 255));
        square02.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square02.setText("RCS");
        square02.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square02.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square02.setMaximumSize(new java.awt.Dimension(30, 20));
        square02.setMinimumSize(new java.awt.Dimension(30, 20));
        square02.setPreferredSize(new java.awt.Dimension(30, 20));

        square03.setForeground(new java.awt.Color(255, 255, 255));
        square03.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square03.setText("RCS");
        square03.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square03.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square03.setMaximumSize(new java.awt.Dimension(30, 20));
        square03.setMinimumSize(new java.awt.Dimension(30, 20));
        square03.setPreferredSize(new java.awt.Dimension(30, 20));

        square04.setForeground(new java.awt.Color(255, 255, 255));
        square04.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square04.setText("RCS");
        square04.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square04.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square04.setMaximumSize(new java.awt.Dimension(30, 20));
        square04.setMinimumSize(new java.awt.Dimension(30, 20));
        square04.setPreferredSize(new java.awt.Dimension(30, 20));

        square05.setForeground(new java.awt.Color(255, 255, 255));
        square05.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square05.setText("RCS");
        square05.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square05.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square05.setMaximumSize(new java.awt.Dimension(30, 20));
        square05.setMinimumSize(new java.awt.Dimension(30, 20));
        square05.setPreferredSize(new java.awt.Dimension(30, 20));

        square15.setForeground(new java.awt.Color(255, 255, 255));
        square15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square15.setText("RCS");
        square15.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square15.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square15.setMaximumSize(new java.awt.Dimension(30, 20));
        square15.setMinimumSize(new java.awt.Dimension(30, 20));
        square15.setPreferredSize(new java.awt.Dimension(30, 20));

        square14.setForeground(new java.awt.Color(255, 255, 255));
        square14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square14.setText("RCS");
        square14.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square14.setMaximumSize(new java.awt.Dimension(30, 20));
        square14.setMinimumSize(new java.awt.Dimension(30, 20));
        square14.setPreferredSize(new java.awt.Dimension(30, 20));

        square13.setForeground(new java.awt.Color(255, 255, 255));
        square13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square13.setText("RCS");
        square13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square13.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square13.setMaximumSize(new java.awt.Dimension(30, 20));
        square13.setMinimumSize(new java.awt.Dimension(30, 20));
        square13.setPreferredSize(new java.awt.Dimension(30, 20));

        square12.setForeground(new java.awt.Color(255, 255, 255));
        square12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square12.setText("RCS");
        square12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square12.setMaximumSize(new java.awt.Dimension(30, 20));
        square12.setMinimumSize(new java.awt.Dimension(30, 20));
        square12.setPreferredSize(new java.awt.Dimension(30, 20));

        square11.setForeground(new java.awt.Color(255, 255, 255));
        square11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square11.setText("RCS");
        square11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square11.setMaximumSize(new java.awt.Dimension(30, 20));
        square11.setMinimumSize(new java.awt.Dimension(30, 20));
        square11.setPreferredSize(new java.awt.Dimension(30, 20));

        square10.setForeground(new java.awt.Color(255, 255, 255));
        square10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square10.setText("RCS");
        square10.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square10.setMaximumSize(new java.awt.Dimension(30, 20));
        square10.setMinimumSize(new java.awt.Dimension(30, 20));
        square10.setPreferredSize(new java.awt.Dimension(30, 20));

        square25.setForeground(new java.awt.Color(255, 255, 255));
        square25.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square25.setText("RCS");
        square25.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square25.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square25.setMaximumSize(new java.awt.Dimension(30, 20));
        square25.setMinimumSize(new java.awt.Dimension(30, 20));
        square25.setPreferredSize(new java.awt.Dimension(30, 20));

        square24.setForeground(new java.awt.Color(255, 255, 255));
        square24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square24.setText("RCS");
        square24.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square24.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square24.setMaximumSize(new java.awt.Dimension(30, 20));
        square24.setMinimumSize(new java.awt.Dimension(30, 20));
        square24.setPreferredSize(new java.awt.Dimension(30, 20));

        square23.setForeground(new java.awt.Color(255, 255, 255));
        square23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square23.setText("RCS");
        square23.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square23.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square23.setMaximumSize(new java.awt.Dimension(30, 20));
        square23.setMinimumSize(new java.awt.Dimension(30, 20));
        square23.setPreferredSize(new java.awt.Dimension(30, 20));

        square22.setForeground(new java.awt.Color(255, 255, 255));
        square22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square22.setText("RCS");
        square22.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square22.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square22.setMaximumSize(new java.awt.Dimension(30, 20));
        square22.setMinimumSize(new java.awt.Dimension(30, 20));
        square22.setPreferredSize(new java.awt.Dimension(30, 20));

        square21.setForeground(new java.awt.Color(255, 255, 255));
        square21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square21.setText("RCS");
        square21.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square21.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square21.setMaximumSize(new java.awt.Dimension(30, 20));
        square21.setMinimumSize(new java.awt.Dimension(30, 20));
        square21.setPreferredSize(new java.awt.Dimension(30, 20));

        square20.setForeground(new java.awt.Color(255, 255, 255));
        square20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square20.setText("RCS");
        square20.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square20.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square20.setMaximumSize(new java.awt.Dimension(30, 20));
        square20.setMinimumSize(new java.awt.Dimension(30, 20));
        square20.setPreferredSize(new java.awt.Dimension(30, 20));

        square35.setForeground(new java.awt.Color(255, 255, 255));
        square35.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square35.setText("RCS");
        square35.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square35.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square35.setMaximumSize(new java.awt.Dimension(30, 20));
        square35.setMinimumSize(new java.awt.Dimension(30, 20));
        square35.setPreferredSize(new java.awt.Dimension(30, 20));

        square34.setForeground(new java.awt.Color(255, 255, 255));
        square34.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square34.setText("RCS");
        square34.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square34.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square34.setMaximumSize(new java.awt.Dimension(30, 20));
        square34.setMinimumSize(new java.awt.Dimension(30, 20));
        square34.setPreferredSize(new java.awt.Dimension(30, 20));

        square33.setForeground(new java.awt.Color(255, 255, 255));
        square33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square33.setText("RCS");
        square33.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square33.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square33.setMaximumSize(new java.awt.Dimension(30, 20));
        square33.setMinimumSize(new java.awt.Dimension(30, 20));
        square33.setPreferredSize(new java.awt.Dimension(30, 20));

        square32.setForeground(new java.awt.Color(255, 255, 255));
        square32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square32.setText("RCS");
        square32.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square32.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square32.setMaximumSize(new java.awt.Dimension(30, 20));
        square32.setMinimumSize(new java.awt.Dimension(30, 20));
        square32.setPreferredSize(new java.awt.Dimension(30, 20));

        square31.setForeground(new java.awt.Color(255, 255, 255));
        square31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square31.setText("RCS");
        square31.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square31.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square31.setMaximumSize(new java.awt.Dimension(30, 20));
        square31.setMinimumSize(new java.awt.Dimension(30, 20));
        square31.setPreferredSize(new java.awt.Dimension(30, 20));

        square30.setForeground(new java.awt.Color(255, 255, 255));
        square30.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square30.setText("RCS");
        square30.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square30.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square30.setMaximumSize(new java.awt.Dimension(30, 20));
        square30.setMinimumSize(new java.awt.Dimension(30, 20));
        square30.setPreferredSize(new java.awt.Dimension(30, 20));

        square45.setForeground(new java.awt.Color(255, 255, 255));
        square45.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square45.setText("RCS");
        square45.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square45.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square45.setMaximumSize(new java.awt.Dimension(30, 20));
        square45.setMinimumSize(new java.awt.Dimension(30, 20));
        square45.setPreferredSize(new java.awt.Dimension(30, 20));

        square44.setForeground(new java.awt.Color(255, 255, 255));
        square44.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square44.setText("RCS");
        square44.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square44.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square44.setMaximumSize(new java.awt.Dimension(30, 20));
        square44.setMinimumSize(new java.awt.Dimension(30, 20));
        square44.setPreferredSize(new java.awt.Dimension(30, 20));

        square43.setForeground(new java.awt.Color(255, 255, 255));
        square43.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square43.setText("RCS");
        square43.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square43.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square43.setMaximumSize(new java.awt.Dimension(30, 20));
        square43.setMinimumSize(new java.awt.Dimension(30, 20));
        square43.setPreferredSize(new java.awt.Dimension(30, 20));

        square42.setForeground(new java.awt.Color(255, 255, 255));
        square42.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square42.setText("RCS");
        square42.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square42.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square42.setMaximumSize(new java.awt.Dimension(30, 20));
        square42.setMinimumSize(new java.awt.Dimension(30, 20));
        square42.setPreferredSize(new java.awt.Dimension(30, 20));

        square41.setForeground(new java.awt.Color(255, 255, 255));
        square41.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square41.setText("RCS");
        square41.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square41.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square41.setMaximumSize(new java.awt.Dimension(30, 20));
        square41.setMinimumSize(new java.awt.Dimension(30, 20));
        square41.setPreferredSize(new java.awt.Dimension(30, 20));

        square40.setForeground(new java.awt.Color(255, 255, 255));
        square40.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square40.setText("RCS");
        square40.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square40.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square40.setMaximumSize(new java.awt.Dimension(30, 20));
        square40.setMinimumSize(new java.awt.Dimension(30, 20));
        square40.setPreferredSize(new java.awt.Dimension(30, 20));

        square55.setForeground(new java.awt.Color(255, 255, 255));
        square55.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square55.setText("RCS");
        square55.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square55.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square55.setMaximumSize(new java.awt.Dimension(30, 20));
        square55.setMinimumSize(new java.awt.Dimension(30, 20));
        square55.setPreferredSize(new java.awt.Dimension(30, 20));

        square54.setForeground(new java.awt.Color(255, 255, 255));
        square54.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square54.setText("RCS");
        square54.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square54.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square54.setMaximumSize(new java.awt.Dimension(30, 20));
        square54.setMinimumSize(new java.awt.Dimension(30, 20));
        square54.setPreferredSize(new java.awt.Dimension(30, 20));

        square53.setForeground(new java.awt.Color(255, 255, 255));
        square53.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square53.setText("RCS");
        square53.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square53.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square53.setMaximumSize(new java.awt.Dimension(30, 20));
        square53.setMinimumSize(new java.awt.Dimension(30, 20));
        square53.setPreferredSize(new java.awt.Dimension(30, 20));

        square52.setForeground(new java.awt.Color(255, 255, 255));
        square52.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square52.setText("RCS");
        square52.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square52.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square52.setMaximumSize(new java.awt.Dimension(30, 20));
        square52.setMinimumSize(new java.awt.Dimension(30, 20));
        square52.setPreferredSize(new java.awt.Dimension(30, 20));

        square51.setForeground(new java.awt.Color(255, 255, 255));
        square51.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square51.setText("RCS");
        square51.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square51.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square51.setMaximumSize(new java.awt.Dimension(30, 20));
        square51.setMinimumSize(new java.awt.Dimension(30, 20));
        square51.setPreferredSize(new java.awt.Dimension(30, 20));

        square50.setForeground(new java.awt.Color(255, 255, 255));
        square50.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        square50.setText("RCS");
        square50.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        square50.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        square50.setMaximumSize(new java.awt.Dimension(30, 20));
        square50.setMinimumSize(new java.awt.Dimension(30, 20));
        square50.setPreferredSize(new java.awt.Dimension(30, 20));

        javax.swing.GroupLayout FieldPanelLayout = new javax.swing.GroupLayout(FieldPanel);
        FieldPanel.setLayout(FieldPanelLayout);
        FieldPanelLayout.setHorizontalGroup(
            FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(FieldPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square00, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square01, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square02, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square03, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square04, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square05, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square11, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square12, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square13, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square14, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square15, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square20, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square21, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square22, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square23, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square24, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square25, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square30, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square31, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square32, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square33, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square34, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square35, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square40, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square41, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square42, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square43, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square44, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square45, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(FieldPanelLayout.createSequentialGroup()
                        .addComponent(square50, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square51, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square52, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square53, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square54, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(square55, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(380, Short.MAX_VALUE))
        );
        FieldPanelLayout.setVerticalGroup(
            FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(FieldPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square00, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square01, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square02, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square03, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square04, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square05, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square10, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square11, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square13, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square14, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square15, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square20, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square21, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square22, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square23, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square24, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square25, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square30, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square31, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square32, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square33, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square34, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square35, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square40, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square41, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square42, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square43, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square44, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square45, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(FieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(square50, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square51, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square52, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square53, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square54, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(square55, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(199, Short.MAX_VALUE))
        );

        ConfigLabel.setFont(new java.awt.Font("Segoe UI", 0, 14));
        ConfigLabel.setText("Configuração:");

        LinesLabel.setText("Linhas:");

        ColumnsLabel.setText("Colunas:");

        RabbitsLabel.setText("Coelhos:");

        RabbitsField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        RabbitsField.setText("3");
        RabbitsField.setMaximumSize(new java.awt.Dimension(25, 20));
        RabbitsField.setMinimumSize(new java.awt.Dimension(25, 20));
        RabbitsField.setPreferredSize(new java.awt.Dimension(25, 20));

        EnergiesLabel.setFont(new java.awt.Font("Segoe UI", 0, 14));
        EnergiesLabel.setText("Energias:");

        EgField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        EgField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        EgField.setText("2");
        EgField.setMaximumSize(new java.awt.Dimension(25, 20));
        EgField.setMinimumSize(new java.awt.Dimension(25, 20));
        EgField.setPreferredSize(new java.awt.Dimension(25, 20));

        EgLabel.setText("Eg:");

        EsLabel.setText("Es:");

        EsField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        EsField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        EsField.setText("10");
        EsField.setMaximumSize(new java.awt.Dimension(25, 20));
        EsField.setMinimumSize(new java.awt.Dimension(25, 20));
        EsField.setPreferredSize(new java.awt.Dimension(25, 20));

        EfLabel.setText("Ef:");

        EfField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        EfField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        EfField.setText("20");
        EfField.setMaximumSize(new java.awt.Dimension(25, 20));
        EfField.setMinimumSize(new java.awt.Dimension(25, 20));
        EfField.setPreferredSize(new java.awt.Dimension(25, 20));

        EtField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        EtField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        EtField.setText("1");
        EtField.setMaximumSize(new java.awt.Dimension(25, 20));
        EtField.setMinimumSize(new java.awt.Dimension(25, 20));
        EtField.setPreferredSize(new java.awt.Dimension(25, 20));

        EtLabel.setText("Et:");

        EjLabel.setText("Ej:");

        EjField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        EjField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        EjField.setText("1");
        EjField.setMaximumSize(new java.awt.Dimension(25, 20));
        EjField.setMinimumSize(new java.awt.Dimension(25, 20));
        EjField.setPreferredSize(new java.awt.Dimension(25, 20));

        OthersLabel.setFont(new java.awt.Font("Segoe UI", 0, 14));
        OthersLabel.setText("Outros:");

        TfLabel.setText("Tf:");

        TfField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        TfField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        TfField.setText("3");
        TfField.setMaximumSize(new java.awt.Dimension(25, 20));
        TfField.setMinimumSize(new java.awt.Dimension(25, 20));
        TfField.setPreferredSize(new java.awt.Dimension(25, 20));

        SminLabel.setText("Smin:");

        SminField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        SminField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        SminField.setText("5");
        SminField.setMaximumSize(new java.awt.Dimension(25, 20));
        SminField.setMinimumSize(new java.awt.Dimension(25, 20));
        SminField.setPreferredSize(new java.awt.Dimension(25, 20));

        LinesSpinner.setModel(new javax.swing.SpinnerNumberModel(4, 4, 6, 1));

        ColumnsSpinner.setModel(new javax.swing.SpinnerNumberModel(4, 4, 6, 1));

        SmaxLabel.setText("Smax:");

        SmaxField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        SmaxField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        SmaxField.setText("10");
        SmaxField.setMaximumSize(new java.awt.Dimension(25, 20));
        SmaxField.setMinimumSize(new java.awt.Dimension(25, 20));
        SmaxField.setPreferredSize(new java.awt.Dimension(25, 20));

        FileMenu.setText("File");

        QuitItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        QuitItem.setText("Quit");
        QuitItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                QuitItemActionPerformed(evt);
            }
        });
        FileMenu.add(QuitItem);

        TopMenu.add(FileMenu);

        ActionMenu.setText("Action");

        StartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        StartItem.setText("Start");
        StartItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StartItemActionPerformed(evt);
            }
        });
        ActionMenu.add(StartItem);

        StopItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        StopItem.setText("Stop");
        StopItem.setEnabled(false);
        StopItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StopItemActionPerformed(evt);
            }
        });
        ActionMenu.add(StopItem);

        TopMenu.add(ActionMenu);

        MethodMenu.setText("Method");

        ConcurItem.setSelected(true);
        ConcurItem.setText("Concurrency");
        ConcurItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConcurItemActionPerformed(evt);
            }
        });
        MethodMenu.add(ConcurItem);

        SocketItem.setText("Sockets");
        SocketItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SocketItemActionPerformed(evt);
            }
        });
        MethodMenu.add(SocketItem);

        rmiItem.setText("RMI");
        rmiItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rmiItemActionPerformed(evt);
            }
        });
        MethodMenu.add(rmiItem);

        TopMenu.add(MethodMenu);

        setJMenuBar(TopMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(StatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(FieldPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(ConfigLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(LinesLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LinesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23)
                        .addComponent(ColumnsLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ColumnsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(EnergiesLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(EgLabel)
                            .addComponent(EtLabel)
                            .addComponent(TfLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(TfField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(SminLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SminField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SmaxLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SmaxField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(EtField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(EjLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(EjField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(RabbitsLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(RabbitsField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(EgField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(EsLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(EsField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(EfLabel)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(EfField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(OthersLabel)))
                .addGap(21, 21, 21))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FieldPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ConfigLabel)
                        .addGap(11, 11, 11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ColumnsLabel)
                            .addComponent(LinesLabel)
                            .addComponent(LinesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ColumnsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(RabbitsField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(RabbitsLabel))
                        .addGap(18, 18, 18)
                        .addComponent(EnergiesLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(EgLabel)
                            .addComponent(EgField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EsLabel)
                            .addComponent(EsField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EfLabel)
                            .addComponent(EfField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(EtField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EtLabel)
                            .addComponent(EjLabel)
                            .addComponent(EjField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(65, 65, 65)
                        .addComponent(OthersLabel)
                        .addGap(9, 9, 9)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TfLabel)
                            .addComponent(TfField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SminLabel)
                            .addComponent(SminField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(SmaxLabel)
                            .addComponent(SmaxField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(StatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    private void QuitItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuitItemActionPerformed
        if(this.StopItem.isEnabled() == false)
            this.dispose();
        else
            JOptionPane.showMessageDialog(null, "Stop the action before quiting.");
    }//GEN-LAST:event_QuitItemActionPerformed

    private void StartItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StartItemActionPerformed
        this.input = new int[11];
        input[0] = ((Integer)LinesSpinner.getValue()).intValue();
        input[1] = ((Integer)ColumnsSpinner.getValue()).intValue();
        input[2] = Integer.parseInt(RabbitsField.getText());
        input[3] = Integer.parseInt(EgField.getText());
        input[4] = Integer.parseInt(EfField.getText());
        input[5] = Integer.parseInt(TfField.getText());
        input[6] = Integer.parseInt(SminField.getText());
        input[7] = Integer.parseInt(SmaxField.getText());
        input[8] = Integer.parseInt(EtField.getText());
        input[9] = Integer.parseInt(EsField.getText());
        input[10] = Integer.parseInt(EjField.getText());

        //Validar número de Coelhos e Cenouras
        if((input[2]>=0) && (input[2]<=(input[0]*input[1])))
        {
            this.StopItem.setEnabled(true);
            this.StartItem.setEnabled(false);
            this.stopFlag = false;

            Thread[] TheRabbits = new Thread[input[2]];
            Thread[] TheCarrots = new Thread[input[1]*input[0]];
            Monitor.Prado campoM = null;
            Server.Prado campoS = null;
            RMI.Server.Prado campoR = null;
            Registry registo = null;
            RemotePrado stub = null;

            for(int i=0; i<input[1]; i++)
            for(int j=0; j<input[0]; j++)
                this.updateField(i, j, false, false, false);
            if((input[0] != 6) || (input[1] != 6))
                hideSquares(input[0], input[1]);

            if (System.getSecurityManager () == null)
                System.setSecurityManager (new RMISecurityManager ());

            //criar prado
            if(this.ConcurItem.isSelected()) {
                campoM = new Monitor.Prado(input[0], input[1], input[2], this, input, TheRabbits, TheCarrots);
                prado = new Thread(campoM);
            }
            else if(this.SocketItem.isSelected()) {
                campoS = new Server.Prado(input[0], input[1], input[2], this, input, TheRabbits, TheCarrots, Integer.parseInt(portfield.getText()));
                prado = new Thread(campoS);
            }
            else{
                campoR = new RMI.Server.Prado(input[0], input[1], input[2], this, input, TheCarrots, TheCarrots);
                prado = new Thread(campoR);
                try {
                    stub = (RemotePrado)UnicastRemoteObject.exportObject(campoR, 0);
                }
                catch (Exception e) {
                        System.err.println ("ComputeEngine stub generation exception: " + e.getMessage ());
                }
                try {
                    registo = LocateRegistry.getRegistry (addressfield.getText(), Integer.parseInt(portfield.getText()));
                }
                catch (Exception e) {
                    System.err.println ("RMI registry location exception: " + e.getMessage ());
                }
                try {
                    registo.rebind ("Prado", stub);
                }
                catch (Exception e) {
                    System.err.println ("Barbershop registering exception: " + e.getMessage ());
                }
            }

            //Iniciar coelhos
            int[][] mem = new int[input[1]][input[0]];
            for(int i=0; i<input[1]; i++)
            for(int j=0; j<input[0]; j++)
                mem[i][j] = 0;

            Random GPS = new Random();
            for(int i=1; i<=input[2]; i++) {
                //Escolher localização aleatóriamente e criar thread
                int x = GPS.nextInt(input[1]);
                int y = GPS.nextInt(input[0]);
                if(mem[x][y] == 0) {
                    if(this.ConcurItem.isSelected())
                        TheRabbits[i-1] = new Thread(new CoelhoConcorrente(campoM, i, input[4], input[9], input[10], input[8], y, x, input[0], input[1]), "coelho"+i);
                    else if(this.SocketItem.isSelected()){
                        TheRabbits[i-1] = new Thread(new CoelhoSocket(campoS, i, input[4], input[9], input[10], input[8], y, x, input[0], input[1], addressfield.getText(), Integer.parseInt(portfield.getText()),Integer.parseInt(portfield.getText())), "coelho"+i);
                    }
                    else
                        TheRabbits[i-1] = new Thread(new CoelhoRemote(stub, i, input[4], input[9], input[10], input[8], y, x, input[0], input[1]), "coelho"+i);
                    mem[x][y] = 1;
                }
                else
                    i--;
            }

            //Criar threads das cenouras
            for(int j=0; j<input[0]; j++)
                for(int i=0; i<input[1]; i++) {
                    if(this.ConcurItem.isSelected())
                        TheCarrots[j*input[1]+i] = new Thread(new CenouraConcorrente(campoM, (j*input[1])+i+1, input[3], input[4], input[5], input[8], input[6], input[7], j, i), "cenoura"+((i*j)+(j*input[1])+1));
                    else if(this.SocketItem.isSelected()) {
                        TheCarrots[j*input[1]+i] = new Thread(new CenouraSocket(campoS, (j*input[1])+i+1, input[3], input[4], input[5], input[8], input[6], input[7], j, i, addressfield.getText(), Integer.parseInt(portfield.getText()),Integer.parseInt(portfield.getText())), "cenoura"+((i*j)+(j*input[1])+1));
                    }
                    else
                        TheCarrots[j*input[1]+i] = new Thread(new CenouraRemote(stub, (j*input[1])+i+1, input[3], input[4], input[5], input[8], input[6], input[7], j, i), "cenoura"+((i*j)+(j*input[1])+1));
                }
            //Iniciar todos os threads e iniciar monitor/servidor
            prado.start();
            for(int i=0; i<TheRabbits.length; i++){
                TheRabbits[i].start();
            }
            for(int i=0; i<TheCarrots.length; i++){
                TheCarrots[i].start();
            }
        }
        else
            JOptionPane.showMessageDialog(null, "Incorrect amount of rabbits. The amount of rabbits must be between 0 and " + input[0]*input[1] + ".");
    }//GEN-LAST:event_StartItemActionPerformed

    private void StopItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopItemActionPerformed
        this.stopFlag = true;
        this.StartItem.setEnabled(true);
        this.StopItem.setEnabled(false);
        for(int i=0; i<6; i++)
            for(int j=0; j<6; j++)
                this.updateField(i, j, true, true, true);
        showSquares();
    }//GEN-LAST:event_StopItemActionPerformed

    private void ConcurItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConcurItemActionPerformed
        this.ConcurItem.setSelected(true);
        this.SocketItem.setSelected(false);
        this.rmiItem.setSelected(false);
    }//GEN-LAST:event_ConcurItemActionPerformed

    private void SocketItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SocketItemActionPerformed
        this.ConcurItem.setSelected(false);
        this.SocketItem.setSelected(true);
        this.rmiItem.setSelected(false);
    }//GEN-LAST:event_SocketItemActionPerformed

    private void rmiItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rmiItemActionPerformed
        this.ConcurItem.setSelected(false);
        this.SocketItem.setSelected(false);
        this.rmiItem.setSelected(true);
    }//GEN-LAST:event_rmiItemActionPerformed

    private void addressfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addressfieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_addressfieldActionPerformed

    private void applyaddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyaddressActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_applyaddressActionPerformed

    public synchronized void updateField(int x, int y, boolean r, boolean c, boolean s) {
        switch(x) {
            case 0:
                switch(y) {
                    case 0: square00.setText(updateSquare(r,c,s));
                            break;
                    case 1: square10.setText(updateSquare(r,c,s));
                            break;
                    case 2: square20.setText(updateSquare(r,c,s));
                            break;
                    case 3: square30.setText(updateSquare(r,c,s));
                            break;
                    case 4: square40.setText(updateSquare(r,c,s));
                            break;
                    case 5: square50.setText(updateSquare(r,c,s));
                }break;
            case 1:
                switch(y) {
                    case 0: square01.setText(updateSquare(r,c,s));
                            break;
                    case 1: square11.setText(updateSquare(r,c,s));
                            break;
                    case 2: square21.setText(updateSquare(r,c,s));
                            break;
                    case 3: square31.setText(updateSquare(r,c,s));
                            break;
                    case 4: square41.setText(updateSquare(r,c,s));
                            break;
                    case 5: square51.setText(updateSquare(r,c,s));
                }break;
            case 2:
                switch(y) {
                    case 0: square02.setText(updateSquare(r,c,s));
                            break;
                    case 1: square12.setText(updateSquare(r,c,s));
                            break;
                    case 2: square22.setText(updateSquare(r,c,s));
                            break;
                    case 3: square32.setText(updateSquare(r,c,s));
                            break;
                    case 4: square42.setText(updateSquare(r,c,s));
                            break;
                    case 5: square52.setText(updateSquare(r,c,s));
                }break;
            case 3:
                switch(y) {
                    case 0: square03.setText(updateSquare(r,c,s));
                            break;
                    case 1: square13.setText(updateSquare(r,c,s));
                            break;
                    case 2: square23.setText(updateSquare(r,c,s));
                            break;
                    case 3: square33.setText(updateSquare(r,c,s));
                            break;
                    case 4: square43.setText(updateSquare(r,c,s));
                            break;
                    case 5: square53.setText(updateSquare(r,c,s));
                }break;
            case 4:
                switch(y) {
                    case 0: square04.setText(updateSquare(r,c,s));
                            break;
                    case 1: square14.setText(updateSquare(r,c,s));
                            break;
                    case 2: square24.setText(updateSquare(r,c,s));
                            break;
                    case 3: square34.setText(updateSquare(r,c,s));
                            break;
                    case 4: square44.setText(updateSquare(r,c,s));
                            break;
                    case 5: square54.setText(updateSquare(r,c,s));
                }break;
            case 5:
                switch(y) {
                    case 0: square05.setText(updateSquare(r,c,s));
                            break;
                    case 1: square15.setText(updateSquare(r,c,s));
                            break;
                    case 2: square25.setText(updateSquare(r,c,s));
                            break;
                    case 3: square35.setText(updateSquare(r,c,s));
                            break;
                    case 4: square45.setText(updateSquare(r,c,s));
                            break;
                    case 5: square55.setText(updateSquare(r,c,s));
                }
        }
    }

    private String updateSquare(boolean r, boolean c, boolean s) {
        if(!r && !c && !s)
            return "   ";
        else if(!r && !c && s)
            return "  S";
        else if(!r && c && !s)
            return " C ";
        else if(!r && c && s)
            return " CS";
        else if(r && !c && !s)
            return "R  ";
        else if(r && !c && s)
            return "R S";
        else if(r && c && !s)
            return "RC ";
        else
            return "RCS";
    }

    private void hideSquares(int numL, int numC) {
        if(numC < 6) {
            square05.setVisible(false);
            square15.setVisible(false);
            square25.setVisible(false);
            square35.setVisible(false);
            square45.setVisible(false);
            square55.setVisible(false);
        }
        if(numC < 5) {
            square04.setVisible(false);
            square14.setVisible(false);
            square24.setVisible(false);
            square34.setVisible(false);
            square44.setVisible(false);
            square54.setVisible(false);
        }
        if(numL < 6) {
            square50.setVisible(false);
            square51.setVisible(false);
            square52.setVisible(false);
            square53.setVisible(false);
            square54.setVisible(false);
            square55.setVisible(false);
        }
        if(numL < 5) {
            square40.setVisible(false);
            square41.setVisible(false);
            square42.setVisible(false);
            square43.setVisible(false);
            square44.setVisible(false);
            square45.setVisible(false);
        }
    }

    private void showSquares() {
        square04.setVisible(true);
        square05.setVisible(true);
        square14.setVisible(true);
        square15.setVisible(true);
        square24.setVisible(true);
        square25.setVisible(true);
        square34.setVisible(true);
        square35.setVisible(true);
        square40.setVisible(true);
        square41.setVisible(true);
        square42.setVisible(true);
        square43.setVisible(true);
        square44.setVisible(true);
        square45.setVisible(true);
        square50.setVisible(true);
        square51.setVisible(true);
        square52.setVisible(true);
        square53.setVisible(true);
        square54.setVisible(true);
        square55.setVisible(true);
    }

    public void setTask(String task) {
        if(task == null) {
            this.TaskLabel.setVisible(false);
            this.ProgressBar.setVisible(false);
            this.ProgressBar.setValue(0);
            this.TaskLabel.setText("");
        }
        else {
            this.TaskLabel.setText(task);
            this.TaskLabel.setVisible(true);
            this.ProgressBar.setVisible(true);
        }
    }

    public void setMax(int max) {
        this.ProgressBar.setMaximum(max);
    }

    public void doStep() {
        this.ProgressBar.setValue(this.ProgressBar.getValue() + 1);
    }

    public boolean getFlag() {
        return stopFlag;
    }

    public void gameOver() {
        this.StartItem.setEnabled(true);
        this.StopItem.setEnabled(false);
        for(int i=0; i<6; i++)
            for(int j=0; j<6; j++)
                this.updateField(i, j, true, true, true);
        showSquares();
    }

    public void endMessage(int val) {
        if(val == 0)
            JOptionPane.showMessageDialog(null, "Simulation Finished.");
        else
            JOptionPane.showMessageDialog(null, "Simulation Destroyed.");
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Outdoor().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu ActionMenu;
    private javax.swing.JLabel ColumnsLabel;
    private javax.swing.JSpinner ColumnsSpinner;
    private javax.swing.JRadioButtonMenuItem ConcurItem;
    private javax.swing.JLabel ConfigLabel;
    private javax.swing.JFormattedTextField EfField;
    private javax.swing.JLabel EfLabel;
    private javax.swing.JFormattedTextField EgField;
    private javax.swing.JLabel EgLabel;
    private javax.swing.JFormattedTextField EjField;
    private javax.swing.JLabel EjLabel;
    private javax.swing.JLabel EnergiesLabel;
    private javax.swing.JFormattedTextField EsField;
    private javax.swing.JLabel EsLabel;
    private javax.swing.JFormattedTextField EtField;
    private javax.swing.JLabel EtLabel;
    private javax.swing.JPanel FieldPanel;
    private javax.swing.JMenu FileMenu;
    private javax.swing.JLabel LinesLabel;
    private javax.swing.JSpinner LinesSpinner;
    private javax.swing.JMenu MethodMenu;
    private javax.swing.JLabel OthersLabel;
    private javax.swing.JProgressBar ProgressBar;
    private javax.swing.JMenuItem QuitItem;
    private javax.swing.JFormattedTextField RabbitsField;
    private javax.swing.JLabel RabbitsLabel;
    private javax.swing.JFormattedTextField SmaxField;
    private javax.swing.JLabel SmaxLabel;
    private javax.swing.JFormattedTextField SminField;
    private javax.swing.JLabel SminLabel;
    private javax.swing.JRadioButtonMenuItem SocketItem;
    private javax.swing.JMenuItem StartItem;
    private javax.swing.JPanel StatusPanel;
    private javax.swing.JMenuItem StopItem;
    private javax.swing.JLabel TaskLabel;
    private javax.swing.JFormattedTextField TfField;
    private javax.swing.JLabel TfLabel;
    private javax.swing.JMenuBar TopMenu;
    private javax.swing.JTextField addressfield;
    private javax.swing.JButton applyaddress;
    private javax.swing.JLabel lbldoor;
    private javax.swing.JLabel lblend;
    private javax.swing.JTextField portfield;
    private javax.swing.JRadioButtonMenuItem rmiItem;
    private javax.swing.JLabel square00;
    private javax.swing.JLabel square01;
    private javax.swing.JLabel square02;
    private javax.swing.JLabel square03;
    private javax.swing.JLabel square04;
    private javax.swing.JLabel square05;
    private javax.swing.JLabel square10;
    private javax.swing.JLabel square11;
    private javax.swing.JLabel square12;
    private javax.swing.JLabel square13;
    private javax.swing.JLabel square14;
    private javax.swing.JLabel square15;
    private javax.swing.JLabel square20;
    private javax.swing.JLabel square21;
    private javax.swing.JLabel square22;
    private javax.swing.JLabel square23;
    private javax.swing.JLabel square24;
    private javax.swing.JLabel square25;
    private javax.swing.JLabel square30;
    private javax.swing.JLabel square31;
    private javax.swing.JLabel square32;
    private javax.swing.JLabel square33;
    private javax.swing.JLabel square34;
    private javax.swing.JLabel square35;
    private javax.swing.JLabel square40;
    private javax.swing.JLabel square41;
    private javax.swing.JLabel square42;
    private javax.swing.JLabel square43;
    private javax.swing.JLabel square44;
    private javax.swing.JLabel square45;
    private javax.swing.JLabel square50;
    private javax.swing.JLabel square51;
    private javax.swing.JLabel square52;
    private javax.swing.JLabel square53;
    private javax.swing.JLabel square54;
    private javax.swing.JLabel square55;
    // End of variables declaration//GEN-END:variables

}
